package test;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Scheduler;
 
import org.quartz.StatefulJob;


public class HelloJob implements StatefulJob {
	private static final Log log = LogFactory.getLog(HelloJob.class);
//	private String clientId;
//	private String reportUrl;
//	private String tel;
	
	/**
	 * package_name: test
	 * file_name:    HelloJob.java
	 * description: 
	 * 2013-8-23上午11:51:41
	 * Author: chenhui
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

//	public HelloJob(String clientId,String reportUrl,String tel){
//		this.clientId = clientId;
//		this.reportUrl = reportUrl;
//		this.tel = tel;
//	}
	
	
	@Override
	public void execute(JobExecutionContext context)
			throws JobExecutionException {
		// TODO Auto-generated method stub
 
		
 
		String triggerName =  context.getTrigger().getName();
		String groupName =context.getTrigger().getGroup(); 
		String clientId = context.getJobDetail().getJobDataMap().getString("clientId");
		String reportUrl = context.getJobDetail().getJobDataMap().getString("reportUrl");
		String tel = context.getJobDetail().getJobDataMap().getString("tel");
		log.info(tel+",I am HelloJob..........triggerName:"+triggerName+",groupName:"+groupName+",cid:"+clientId+",rUrl:"+reportUrl);
		
		
//		context.getTrigger().getFullName()
		 try {
			Scheduler scheduler  = context.getScheduler();
//			Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
//			scheduler.unscheduleJob(triggerName, groupName);
//			
			log.info("schedulerNameInJob:"+scheduler.getSchedulerName()+",id:"+scheduler.getSchedulerInstanceId());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
 

}
